Skip to content

Conversation

DaviRain-Su
Copy link

Add pub fn declareEntrypoint(comptime process_instruction: processInstruction) void ; so we can just only write processInstruction

Copy link
Owner

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! I like the concept, we just need to figure out what to do for the error type

Comment on lines +1 to +6
pub const ProgramError = error{
AlreadyInUse,
InvalidAccountType,
Uninitialized,
IncorrectSize,
};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to add these and have them work similarly to the program error in the Rust SDK, may as well just copy all the variants at https://github.com/anza-xyz/solana-sdk/blob/2d88eb491e52705ec73ee8204dc41d510c298909/program-error/src/lib.rs#L57, but that will require also setting the values individually, ie:

const ProgramError = enum(u64) {
    InvalidArgument = 1 << 32,
    InvalidInstructionData = 2 << 32,
};

And so on. That'll be a bit more conformant than this error type.

On the other hand, it's not a proper zig error, which makes me think we might want to omit this entirely, and allow processInstruction to return any error. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants